<%@page import="com.bstek.urule.accident.entity.Customer"%>
<%@page contentType="text/html; charset=utf8" %>
<%@page import="com.bstek.urule.*" %>
<%@page import="java.util.*"%>
<%@page import="com.bstek.urule.runtime.*"%>
<%@page import="com.bstek.urule.runtime.service.*"%>
<html>
<body>
<h2>规则调用</h2>
<%
KnowledgeService knowledgeService = (KnowledgeService)Utils.getApplicationContext().getBean(KnowledgeService.BEAN_ID);
KnowledgePackage kp = knowledgeService.getKnowledge("寿险意外险核保项目/totalResultTest");
/*单次调用*/
KnowledgeSession kSession = KnowledgeSessionFactory.newKnowledgeSession(kp);
Customer customer = new Customer();
customer.setId("001");
customer.setAge(20);
customer.setGender(true);
customer.setCholesterol(6d);
customer.setLowDensityLipoprotein(3d);
customer.setSystolic(100d);
//customer.setSystolic(10d);
customer.setDiastolic(70d);
kSession.insert(customer);
kSession.startProcess("totalResultFlow");
out.println("血压评点结果："+customer.getBloodPressureResult()+"，高胆固醇评定级别："+customer.getCholesterolResultLevel()+"<br/><br/>总评点结果："+customer.getTotalResult());
/* 
批量调用
BatchSession bs = KnowledgeSessionFactory.newBatchSession(kp, 3, 10);
for(int i=0;i<100;i++){
	bs.addBusiness(new Business(){
		public void execute(KnowledgeSession session){
			Customer customer = new Customer();
			customer.setId("001");
			customer.setAge(20);
			customer.setGender(true);
			customer.setCholesterol(6d);
			customer.setLowDensityLipoprotein(3d);
			customer.setSystolic(100d);
			customer.setDiastolic(70d);
			session.insert(customer);
			session.startProcess("totalResultFlow");
			System.out.println(customer.getBloodPressureResult()+","+customer.getCholesterolResultLevel()+","+customer.getTotalResult());
		}
	});
}
bs.waitForCompletion(); */
%>
</body>
</html>